package cn.yunhe.biz.impl;

import java.io.IOException;
import java.util.List;

import cn.yunhe.biz.Coursebiz;
import cn.yunhe.dao.impl.BookDaoImpl;
import cn.yunhe.dao.impl.CourseDaoImpl;
import cn.yunhe.dao.impl.CourseDisplayDaoImpl;
import cn.yunhe.entity.Book;
import cn.yunhe.entity.Cart;
import cn.yunhe.entity.Course;
import cn.yunhe.entity.CourseCart;
import cn.yunhe.entity.CourseDisplay;

public class CourseBizImpl implements Coursebiz {

	@Override
	public List<Course> findAll() throws IOException {
		// TODO Auto-generated method stub
		CourseDaoImpl coursedaoimpl=new CourseDaoImpl();
		List<Course> courselist=coursedaoimpl.FindAllCourse();
		return courselist;
	}

	@Override
	public Course findcoursebyid(String cid) throws IOException {
		// TODO Auto-generated method stub
		CourseDaoImpl coursedaoimpl=new CourseDaoImpl();
		Course course=coursedaoimpl.FindCourseByCid(cid);
		return course;
	}
	public List<Course> findcoursebyteacher(String teacher) throws IOException {
		// TODO Auto-generated method stub
		CourseDaoImpl coursedaoimpl=new CourseDaoImpl();
		List<Course> courselist=coursedaoimpl.FindCourseByTeacher(teacher);
		return courselist;
	}
	public void clearcoursecart(CourseCart coursecart) {
		// TODO Auto-generated method stub
		coursecart.getCoursemap().clear();
	}
	public void deletecoursecart(String cid,CourseCart coursecart) {
		// TODO Auto-generated method stub
		coursecart.getCoursemap().remove(cid);
	}
	public void InsertCourseDisplay(CourseDisplay coursedisplay) throws IOException{
		CourseDisplayDaoImpl cddi=new CourseDisplayDaoImpl();
		cddi.InsertCourseDisplay(coursedisplay);
	}
	public void UpdateCourseDisplay(CourseDisplay coursedisplay) throws IOException{
		CourseDisplayDaoImpl cddi=new CourseDisplayDaoImpl();
		cddi.UpdateCourseDisplay(coursedisplay);
	}
	public CourseDisplay FindCourseDisplayById(String sid) throws IOException{
		CourseDisplayDaoImpl cddi=new CourseDisplayDaoImpl();
		CourseDisplay coursedisplay=cddi.FindCourseDisplayById(sid);
		return coursedisplay;
	}
}
